package com.chzc.goods.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.chzc.goods.req.OrderREQ;
import com.chzc.goods.service.IOrderInfoService;
import com.chzc.po.OrderInfo;
import com.chzc.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author CV大魔王
 * @since 2021-05-27
 */
@Api(value = "订单接口(私有)", tags = "订单接口(私有)")
@RestController
@RequestMapping("/pri/order_info")
public class OrderInfoController {

    @Autowired
    private IOrderInfoService orderInfoService;

    @ApiOperation("获取用户个人订单信息")
    @PostMapping("/getMeOrder")
    public IPage<OrderInfo> getMeOrder(@RequestBody OrderREQ req) {
        return orderInfoService.getMeOrder(req);
    }


    @ApiOperation("管理员查询订单列表")
    @PostMapping("/search")
    public IPage<OrderInfo> getPageInfos(@RequestBody OrderREQ req) {
        return orderInfoService.queryPageList(req);
    }

    @ApiOperation("删除订单")
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable String id) {
        return orderInfoService.delete(id);
    }


    @ApiOperation("订单发货")
    @PutMapping("/ship/{id}")
    public Result ship(@PathVariable String id) {
        return orderInfoService.ship(id);
    }

}
